/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package intershopxssscanner.parsers;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Willem
 */
public class HtmlHighlighterParser {
     private Properties defaultProps = new Properties();

    public HtmlHighlighterParser() {
         FileInputStream in = null;
        try {
            in = new FileInputStream("FilterManager.properties");
            defaultProps.load(in);
            in.close();
        } catch (IOException ex) {
            Logger.getLogger(HtmlHighlighterParser.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                in.close();
            } catch (IOException ex) {
                Logger.getLogger(HtmlHighlighterParser.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
    
    public String highLight(String input, String search){
        StringBuilder sb = new StringBuilder();
        String[] lists = input.split("\n");
        
        for(String l :lists){
            sb.append(l.replaceAll(search, "<B>"+search+"<B>")+"\n");
        }
        
        return sb.toString();
    }
    
    
    
}
